home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.image.ImageObserver;
-
- public class HDSBorderPanel2 extends DynamicBorderPanel2 {
- Color activeColor;
- Color inactiveColor;
- int activeColorIndex;
- Image osImage;
- Graphics osg;
- int newThickness;
- int index;
- int sections;
- boolean showLights;
- int currentX;
-
- void GetParameters(Applet var1, int var2) {
- String var3 = var1.getParameter("hdsBorderThickness" + var2);
- ((BorderPanel2)this).SetThickness(AppletParam2.GetInt(var3, 6));
- var3 = var1.getParameter("hdsBorderBkColor" + var2);
- ((BorderPanel2)this).SetBackgroundColor(AppletParam2.GetColor(var3, (Color)null));
- var3 = var1.getParameter("hdsBorderBkImage" + var2);
- ((BorderPanel2)this).SetBackgroundImage(AppletParam2.GetImage(var1, var3));
- var3 = var1.getParameter("hdsBorderActiveColor" + var2);
- this.SetActiveColor(AppletParam2.GetColor(var3, Color.red));
- var3 = var1.getParameter("hdsBorderInactiveColor" + var2);
- this.SetInactiveColor(AppletParam2.GetColor(var3, Color.yellow));
- var3 = var1.getParameter("hdsBorderSectionCount" + var2);
- this.SetSectionCount(AppletParam2.GetInt(var3, 3));
- }
-
- public HDSBorderPanel2(Applet var1, int var2) {
- this.activeColor = Color.red;
- this.inactiveColor = Color.yellow;
- this.sections = 3;
- this.showLights = false;
- this.GetParameters(var1, var2);
- }
-
- public void SetActiveColor(Color var1) {
- this.activeColor = var1;
- }
-
- public void SetInactiveColor(Color var1) {
- this.inactiveColor = var1;
- }
-
- public void SetSectionCount(int var1) {
- this.sections = var1;
- }
-
- public void DoPaint(Graphics var1) {
- if (this.osImage == null) {
- this.osImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
- this.osg = this.osImage.getGraphics();
- }
-
- if (this.showLights) {
- this.osg.setColor(Color.black);
-
- for(int var2 = 0; var2 < this.sections; ++var2) {
- while(this.currentX < ((Component)this).size().width) {
- this.osg.fillOval(this.currentX + var2 * this.newThickness, var2 * this.newThickness, this.newThickness, this.newThickness);
- this.currentX += this.newThickness + 1;
- }
- }
- } else {
- for(int var3 = 0; var3 < super.thickness; ++var3) {
- this.index = var3 / this.newThickness;
- if (this.index == this.activeColorIndex) {
- this.osg.setColor(this.activeColor);
- } else {
- this.osg.setColor(this.inactiveColor);
- }
-
- this.osg.drawRect(var3, var3, ((Component)this).size().width - var3 * 2, ((Component)this).size().height - var3 * 2);
- }
- }
-
- ++this.activeColorIndex;
- if (this.activeColorIndex >= this.sections) {
- this.activeColorIndex = 0;
- }
-
- var1.drawImage(this.osImage, 0, 0, (ImageObserver)null);
- }
-
- void DoResize(int var1, int var2) {
- this.osImage = null;
- this.osg = null;
- this.newThickness = super.thickness / this.sections;
- }
- }
-